home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 12 / BBS in a box XII-1.iso / Files / Game / F-G / Glypha II 1.1.sit / Glypha II 1.1 ƒ / Glypha II 1.1 Source Code ƒ / Code ƒ / H-Initialize.p < prev    next >
Encoding:
Text File  |  1991-05-23  |  18.0 KB  |  632 lines  |  [TEXT/PJMM]

  1. unit Initialize;
  2.  
  3. interface
  4.     uses
  5.         Sound, Palettes, Globals, AboutWndo, Dialogs, GameUtils, Enemies, GlyphaGuts;
  6.  
  7.     procedure InitVariables;
  8.  
  9. implementation
  10.  
  11. {=================================}
  12.  
  13.     procedure InitVariables;
  14.         var
  15.             sizeOfOff, offRowBytes, dummyLong: LongInt;
  16.             i, i2, theDepth, howManySounds: Integer;
  17.             rawPointer: Ptr;
  18.             tempByte: SignedByte;
  19.             thePict: PicHandle;
  20.             tempRect: Rect;
  21.             theSnd: Handle;
  22.             ignore: Boolean;
  23.  
  24. {------------------}
  25.  
  26.         procedure CheckOurEnvirons;
  27.             var
  28.                 err: OSErr;
  29.                 thisWorld: SysEnvRec;
  30.                 theDevice: GDHandle;
  31.         begin
  32.             rightOffset := (ScreenBits.bounds.right - 640) div 2;
  33.             downOffset := (ScreenBits.bounds.bottom - 480) div 2;
  34.  
  35.             err := SysEnvirons(1, thisWorld);    {Check set up the Mac game is on    }
  36.             with thisWorld do
  37.                 begin
  38.                     if (not HasColorQD) then
  39.                         begin
  40.                             GenericAlert(1);
  41.                             ExitToShell;
  42.                         end;
  43.                     if (systemVersion < $0602) then
  44.                         inhibitSound := TRUE        {Global to prevent sound on older    }
  45.                     else                                            {versions of the System.                    }
  46.                         inhibitSound := FALSE;    {Or, we allow sound.                            }
  47.                 end;
  48.             if ((screenBits.bounds.right < 640) or (screenBits.bounds.bottom < 480)) then
  49.                 begin
  50.                     GenericAlert(2);
  51.                     ExitToShell;
  52.                 end;
  53.             theDevice := GetMainDevice;
  54.             HLock(Handle(theDevice));
  55.             if (theDevice^^.gdPMap^^.pixelSize <> 4) then
  56.                 begin
  57.                     HUnlock(Handle(theDevice));
  58.                     GenericAlert(3);
  59.                     ExitToShell;
  60.                 end;
  61.             HUnlock(Handle(theDevice));
  62.  
  63.             hasWNE := (NGetTrapAddress(WNETrapNum, ToolTrap) <> NGetTrapAddress(unimplTrapNum, toolTrap));
  64.         end;
  65.  
  66. {------------------}
  67.  
  68.         procedure Init_My_Menus;
  69.             var
  70.                 aMenu: MenuHandle;
  71.         begin
  72.             ClearMenuBar;                                    {Clear any old menu bars}
  73.             aMenu := GetMenu(mApple);            {Get the menu from the resource file}
  74.             if (aMenu <> nil) then
  75.                 begin
  76.                     AddResMenu(aMenu, 'DRVR');{Add in DAs}
  77.                     InsertMenu(aMenu, 0);            {Insert this menu into the menu bar}
  78.                 end
  79.             else
  80.                 begin
  81.                     GenericAlert(4);
  82.                     ExitToShell;
  83.                 end;
  84.             aMenu := GetMenu(mGame);            {Get the menu from the resource file}
  85.             if (aMenu <> nil) then
  86.                 InsertMenu(aMenu, 0)                {Insert this menu into the menu bar}
  87.             else
  88.                 begin
  89.                     GenericAlert(4);
  90.                     ExitToShell;
  91.                 end;
  92.             DisableItem(aMenu, iPause);
  93.             DisableItem(aMenu, iEnd);
  94.             aMenu := GetMenu(mOptions);        {Get the menu from the resource file}
  95.             if (aMenu <> nil) then
  96.                 InsertMenu(aMenu, 0)                {Insert this menu into the menu bar}
  97.             else
  98.                 begin
  99.                     GenericAlert(4);
  100.                     ExitToShell;
  101.                 end;
  102.             DrawMenuBar;
  103.         end;
  104.  
  105. {------------------}
  106.  
  107.         function NewBitMap (var theBitMap: BitMap; theRect: Rect): Ptr;
  108.         begin
  109.             with theBitMap, theRect do
  110.                 begin
  111.                     rowBytes := ((right - left + 15) div 16) * 2;
  112.                     baseAddr := NewPtr(rowBytes * (bottom - top));
  113.                     bounds := theRect;
  114.                     if MemError <> noErr then
  115.                         begin
  116.                             GenericAlert(4);
  117.                             ExitToShell;
  118.                         end
  119.                     else
  120.                         NewBitMap := baseAddr;
  121.                 end;
  122.         end;
  123.  
  124. {------------------}
  125.  
  126.     begin
  127.         SetApplLimit(Ptr(LongInt(GetApplLimit) - StackSize));
  128.         MaxApplZone;
  129.         for i := 1 to 12 do
  130.             MoreMasters;
  131.         InitGraf(@thePort);
  132.         InitFonts;
  133.         FlushEvents(everyEvent, 0);
  134.         InitWindows;
  135.         InitMenus;
  136.         TEInit;
  137.         InitDialogs(nil);
  138.         InitCursor;
  139.  
  140.         ErrorSound(@DoErrorSound);
  141.  
  142.         for i := 1 to 3 do
  143.             ignore := EventAvail(EveryEvent, theEvent);
  144.  
  145.         inBackground := FALSE;
  146.  
  147.         SetCursor(GetCursor(WatchCursor)^^);
  148.         CheckOurEnvirons;
  149.  
  150.         MoveTo(0, 0);
  151.         playRgn := NewRgn;
  152.         OpenRgn;
  153.         LineTo(0, 450);
  154.         LineTo(161, 450);
  155.         LineTo(161, 269);
  156.         LineTo(172, 250);
  157.         LineTo(182, 269);
  158.         LineTo(182, 450);
  159.         LineTo(457, 450);
  160.         LineTo(457, 269);
  161.         LineTo(468, 250);
  162.         LineTo(478, 269);
  163.         LineTo(478, 450);
  164.         LineTo(640, 450);
  165.         LineTo(640, 0);
  166.         LineTo(0, 0);
  167.         CloseRgn(playRgn);
  168.         MoveHHi(Handle(playRgn));
  169.         HLock(Handle(playRgn));
  170.  
  171.         MoveTo(161, 460);
  172.         obeliskRgn1 := NewRgn;
  173.         OpenRgn;
  174.         LineTo(161, 269);
  175.         LineTo(172, 250);
  176.         LineTo(182, 269);
  177.         LineTo(182, 460);
  178.         LineTo(161, 460);
  179.         CloseRgn(obeliskRgn1);
  180.         MoveHHi(Handle(obeliskRgn1));
  181.         HLock(Handle(obeliskRgn1));
  182.  
  183.         MoveTo(457, 460);
  184.         obeliskRgn2 := NewRgn;
  185.         OpenRgn;
  186.         LineTo(457, 269);
  187.         LineTo(468, 250);
  188.         LineTo(478, 269);
  189.         LineTo(478, 460);
  190.         LineTo(457, 460);
  191.         CloseRgn(obeliskRgn2);
  192.         MoveHHi(Handle(obeliskRgn2));
  193.         HLock(Handle(obeliskRgn2));
  194.  
  195.         howManySounds := Count1Resources('snd ');        {Get number of sounds}
  196.         for i := 1 to howManySounds do
  197.             begin
  198.                 theSnd := Get1IndResource('snd ', i);
  199.                 if (theSnd^ <> nil) then
  200.                     begin
  201.                         MoveHHi(theSnd);
  202.                         HLock(theSnd);
  203.                     end
  204.                 else
  205.                     begin
  206.                         GenericAlert(4);
  207.                         ExitToShell;
  208.                     end;
  209.             end;
  210.  
  211.         FlushEvents(everyEvent, 0);    {Clear out all events}
  212.         Init_My_Menus;                            {Initialize menu bar}
  213.  
  214.         SetRect(wholeArea, 0, 0, 640, 460);
  215.         SetRect(smallOffArea, 0, 0, 512, 270);
  216.  
  217.         rgbBlack.red := 0;
  218.         rgbBlack.green := 0;
  219.         rgbBlack.blue := 0;
  220.         rgbWhite.red := -1;
  221.         rgbWhite.green := -1;
  222.         rgbWhite.blue := -1;
  223.         rgbYellow.red := -1;
  224.         rgbYellow.green := -1;
  225.         rgbYellow.blue := 0;
  226.         rgbRed.red := -1;
  227.         rgbRed.green := 0;
  228.         rgbRed.blue := 0;
  229.         rgbLtBlue.red := 0;
  230.         rgbLtBlue.green := -1;
  231.         rgbLtBlue.blue := -1;
  232.  
  233.         mainWndo := GetNewCWindow(mainWndoID, nil, Pointer(-1));
  234.         if (mainWndo <> nil) then
  235.             begin
  236.                 ShowWindow(mainWndo);
  237.                 SelectWindow(GrafPtr(mainWndo));
  238.                 SetPort(GrafPtr(mainWndo));
  239.                 RGBForeColor(rgbBlack);
  240.                 RGBBackColor(rgbWhite);
  241.             end
  242.         else
  243.             begin
  244.                 GenericAlert(4);
  245.                 ExitToShell;
  246.             end;
  247.         mainPalette := GetNewPalette(mainWndoID);
  248.         if (mainPalette <> nil) then
  249.             SetPalette(mainWndo, mainPalette, TRUE)
  250.         else
  251.             begin
  252.                 GenericAlert(4);
  253.                 ExitToShell;
  254.             end;
  255.  
  256.         OpenLogoWindo(rightOffset, downOffset);
  257.  
  258.         virginCPtr := @virginCPort;
  259.         OpenCPort(virginCPtr);
  260.         theDepth := 4;
  261.         offRowBytes := ((((theDepth * (wholeArea.right - wholeArea.left)) + 15)) div 16) * 2;
  262.         sizeOfOff := LONGINT(wholeArea.bottom - wholeArea.top) * offRowBytes;
  263.         virginCBits := NewPtr(sizeOfOff);
  264.         if (virginCPtr = nil) then
  265.             begin
  266.                 GenericAlert(4);
  267.                 ExitToShell;
  268.             end;
  269.         with virginCPtr^.portPixMap^^ do
  270.             begin
  271.                 baseAddr := virginCBits;
  272.                 rowBytes := offRowBytes + $8000;
  273.                 bounds := wholeArea;
  274.             end;
  275.         RGBForeColor(rgbBlack);
  276.         RGBBackColor(rgbWhite);
  277.         EraseRect(thePort^.portRect);
  278.         ClipRect(wholeArea);
  279.  
  280.         thePict := GetPicture(backPictID);
  281.         if (thePict <> nil) then
  282.             begin
  283.                 tempByte := HGetState(Handle(thePict));
  284.                 MoveHHi(Handle(thePict));
  285.                 HLock(Handle(thePict));
  286.                 DrawPicture(thePict, wholeArea);
  287.                 HSetState(Handle(thePict), tempByte);
  288.             end
  289.         else
  290.             begin
  291.                 GenericAlert(4);
  292.                 ExitToShell;
  293.             end;
  294.         ReleaseResource(Handle(thePict));
  295.  
  296.         loadCPtr := @loadCPort;
  297.         OpenCPort(loadCPtr);
  298.         loadCBits := NewPtr(sizeOfOff);
  299.         if (loadCBits = nil) then
  300.             begin
  301.                 GenericAlert(4);
  302.                 ExitToShell;
  303.             end;
  304.         with loadCPtr^.portPixMap^^ do
  305.             begin
  306.                 baseAddr := loadCBits;
  307.                 rowBytes := offRowBytes + $8000;
  308.                 bounds := wholeArea;
  309.             end;
  310.         RGBForeColor(rgbBlack);
  311.         RGBBackColor(rgbWhite);
  312.         EraseRect(thePort^.portRect);
  313.         ClipRect(wholeArea);
  314.  
  315. {Set up object port}
  316.         offRowBytes := ((((theDepth * (smallOffArea.right - smallOffArea.left)) + 15)) div 16) * 2;
  317.         sizeOfOff := LONGINT(smallOffArea.bottom - smallOffArea.top) * offRowBytes;
  318.         objectCPtr := @objectCPort;
  319.         OpenCPort(objectCPtr);
  320.         objectCBits := NewPtr(sizeOfOff);
  321.         if (objectCBits = nil) then
  322.             begin
  323.                 GenericAlert(4);
  324.                 ExitToShell;
  325.             end;
  326.         with objectCPtr^.portPixMap^^ do
  327.             begin
  328.                 baseAddr := objectCBits;
  329.                 rowBytes := offRowBytes + $8000;
  330.                 bounds := smallOffArea;
  331.             end;
  332.         RGBForeColor(rgbBlack);
  333.         RGBBackColor(rgbWhite);
  334.         EraseRect(thePort^.portRect);
  335.         ClipRect(smallOffArea);
  336.         thePict := GetPicture(objectPictID);
  337.         if (thePict <> nil) then
  338.             begin
  339.                 tempByte := HGetState(Handle(thePict));
  340.                 MoveHHi(Handle(thePict));
  341.                 HLock(Handle(thePict));
  342.                 DrawPicture(thePict, smallOffArea);
  343.                 HSetState(Handle(thePict), tempByte);
  344.             end
  345.         else
  346.             begin
  347.                 GenericAlert(4);
  348.                 ExitToShell;
  349.             end;
  350.         ReleaseResource(Handle(thePict));
  351.  
  352.         rawPointer := NewPtr(SizeOf(GrafPort));    {Initialize and setup offscreen}
  353.         offMaskPort := GrafPtr(rawPointer);
  354.         OpenPort(offMaskPort);
  355.         offMaskBits := NewBitMap(offMaskMap, smallOffArea);
  356.         SetPortBits(offMaskMap);
  357.         EraseRect(offMaskMap.bounds);
  358.         SetPort(offMaskPort);                                    {Set the port to my window}
  359.         thePict := GetPicture(maskPictID);    {Get Picture into memory}
  360.         if (thePict <> nil) then            {Only use handle if it is valid}
  361.             begin
  362.                 ClipRect(smallOffArea);                {Clip picture to this rectangle}
  363.                 HLock(Handle(thePict));            {Lock the handle before using it}
  364.                 DrawPicture(thePict, smallOffArea);     {Draw this picture}
  365.                 ReleaseResource(Handle(thePict));
  366.                 HUnLock(Handle(thePict));        {Unlock the picture again}
  367.             end
  368.         else
  369.             begin
  370.                 GenericAlert(4);
  371.                 ExitToShell;
  372.             end;
  373.  
  374.         numberOfStones := 4;
  375.         levelStart := 1;
  376.         levelOn := 0;
  377.         mortalsStart := defaultNum;
  378.         mortals := mortalsStart;
  379.         score := 0;
  380.         GetDateTime(RandSeed);
  381.         playing := FALSE;
  382.         pausing := FALSE;
  383.  
  384.         chanPtr := nil;
  385.         soundPriority := noSound;
  386.  
  387.         SetRect(playerRects[0, 0], 260, 38, 308, 86);        {Rects for player facing right    }
  388.         SetRect(playerRects[0, 1], 309, 38, 357, 86);        {walking}
  389.         SetRect(playerRects[0, 2], 260, 38, 308, 86);        {walking}
  390.         SetRect(playerRects[0, 3], 309, 38, 357, 86);        {walking}
  391.         SetRect(playerRects[0, 4], 260, 0, 308, 37);        {flapping}
  392.         SetRect(playerRects[0, 5], 309, 0, 357, 37);        {flapping}
  393.         SetRect(playerRects[1, 0], 407, 38, 455, 86);        {Rects for player facing left    }
  394.         SetRect(playerRects[1, 1], 358, 38, 406, 86);        {walking}
  395.         SetRect(playerRects[1, 2], 407, 38, 455, 86);        {walking}
  396.         SetRect(playerRects[1, 3], 358, 38, 406, 86);        {walking}
  397.         SetRect(playerRects[1, 4], 407, 0, 455, 37);        {flapping}
  398.         SetRect(playerRects[1, 5], 358, 0, 406, 37);        {flapping}
  399.  
  400.         SetRect(boneRects[0, 6], 260, 87, 308, 124);        {Falling skeleton left    }
  401.         SetRect(boneRects[1, 6], 309, 87, 357, 124);        {Falling skeleton right    }
  402.         SetRect(boneRects[0, 7], 456, 25, 501, 47);            {Pile of bones - left        }
  403.         SetRect(boneRects[1, 7], 456, 25, 501, 47);            {Same bones for right    }
  404.  
  405.         SetRect(enemyRects[0, 0, 0], 49, 123, 97, 171);    {enemy 1 walking right}
  406.         SetRect(enemyRects[0, 1, 0], 0, 123, 48, 171);    {enemy 1 walking right}
  407.         SetRect(enemyRects[0, 2, 0], 49, 123, 97, 171);    {enemy 1 walking right}
  408.         SetRect(enemyRects[0, 3, 0], 0, 123, 48, 171);    {enemy 1 walking right}
  409.         SetRect(enemyRects[0, 4, 0], 65, 0, 129, 40);        {enemy 1 flapping left}
  410.         SetRect(enemyRects[0, 5, 0], 0, 0, 64, 40);            {enemy 1 flapping left}
  411.         SetRect(enemyRects[1, 0, 0], 49, 172, 97, 220);    {enemy 2 walking right}
  412.         SetRect(enemyRects[1, 1, 0], 0, 172, 48, 220);    {enemy 2 walking right}
  413.         SetRect(enemyRects[1, 2, 0], 49, 172, 97, 220);    {enemy 2 walking right}
  414.         SetRect(enemyRects[1, 3, 0], 0, 172, 48, 220);    {enemy 2 walking right}
  415.         SetRect(enemyRects[1, 4, 0], 65, 41, 129, 81);    {enemy 2 flapping left}
  416.         SetRect(enemyRects[1, 5, 0], 0, 41, 64, 81);        {enemy 2 flapping left}
  417.         SetRect(enemyRects[2, 0, 0], 49, 221, 97, 269);    {enemy 3 walking right}
  418.         SetRect(enemyRects[2, 1, 0], 0, 221, 48, 269);    {enemy 3 walking right}
  419.         SetRect(enemyRects[2, 2, 0], 49, 221, 97, 269);    {enemy 3 walking right}
  420.         SetRect(enemyRects[2, 3, 0], 0, 221, 48, 269);    {enemy 3 walking right}
  421.         SetRect(enemyRects[2, 4, 0], 65, 82, 129, 122);    {enemy 3 flapping left}
  422.         SetRect(enemyRects[2, 5, 0], 0, 82, 64, 122);        {enemy 3 flapping left}
  423.  
  424.         SetRect(enemyRects[0, 0, 1], 98, 123, 146, 171);    {enemy 1 walking left}
  425.         SetRect(enemyRects[0, 1, 1], 147, 123, 195, 171);    {enemy 1 walking left}
  426.         SetRect(enemyRects[0, 2, 1], 98, 123, 146, 171);    {enemy 1 walking left}
  427.         SetRect(enemyRects[0, 3, 1], 147, 123, 195, 171);    {enemy 1 walking left}
  428.         SetRect(enemyRects[0, 4, 1], 130, 0, 194, 40);        {enemy 1 flapping right}
  429.         SetRect(enemyRects[0, 5, 1], 195, 0, 259, 40);        {enemy 1 flapping right}
  430.         SetRect(enemyRects[1, 0, 1], 98, 172, 146, 220);    {enemy 2 walking left}
  431.         SetRect(enemyRects[1, 1, 1], 147, 172, 195, 220);    {enemy 2 walking left}
  432.         SetRect(enemyRects[1, 2, 1], 98, 172, 146, 220);    {enemy 2 walking left}
  433.         SetRect(enemyRects[1, 3, 1], 147, 172, 195, 220);    {enemy 2 walking left}
  434.         SetRect(enemyRects[1, 4, 1], 130, 41, 194, 81);        {enemy 2 flapping right}
  435.         SetRect(enemyRects[1, 5, 1], 195, 41, 259, 81);        {enemy 2 flapping right}
  436.         SetRect(enemyRects[2, 0, 1], 98, 221, 146, 269);    {enemy 3 walking left}
  437.         SetRect(enemyRects[2, 1, 1], 147, 221, 195, 269);    {enemy 3 walking left}
  438.         SetRect(enemyRects[2, 2, 1], 98, 221, 146, 269);    {enemy 3 walking left}
  439.         SetRect(enemyRects[2, 3, 1], 147, 221, 195, 269);    {enemy 3 walking left}
  440.         SetRect(enemyRects[2, 4, 1], 130, 82, 194, 122);    {enemy 3 flapping right}
  441.         SetRect(enemyRects[2, 5, 1], 195, 82, 259, 122);    {enemy 3 flapping right}
  442.  
  443.         enemyLift[0] := -1;
  444.         enemyLift[1] := -2;
  445.         enemyLift[2] := -4;
  446.  
  447.         SetRect(handRects[0], 358, 87, 422, 144);
  448.         SetRect(handRects[1], 424, 87, 489, 144);
  449.  
  450.         SetRect(ankRects[0], 245, 180, 261, 203);
  451.         SetRect(ankRects[1], 262, 180, 278, 203);
  452.         SetRect(ankRects[2], 279, 180, 295, 203);
  453.         SetRect(ankRects[3], 296, 180, 312, 203);
  454.         SetRect(ankRects[4], 313, 180, 329, 203);
  455.         SetRect(ankRects[5], 330, 180, 346, 203);
  456.         SetRect(ankRects[6], 347, 180, 363, 203);
  457.         SetRect(ankRects[7], 364, 180, 380, 203);
  458.         SetRect(ankRects[8], 381, 180, 397, 203);
  459.         SetRect(ankRects[9], 364, 180, 380, 203);
  460.         SetRect(ankRects[10], 347, 180, 363, 203);
  461.         SetRect(ankRects[11], 330, 180, 346, 203);
  462.         SetRect(ankRects[12], 313, 180, 329, 203);
  463.         SetRect(ankRects[13], 296, 180, 312, 203);
  464.         SetRect(ankRects[14], 279, 180, 295, 203);
  465.         SetRect(ankRects[15], 262, 180, 278, 203);
  466.  
  467.         for i := 0 to 1 do
  468.             for i2 := 0 to 5 do
  469.                 SetRect(absoluteRects[i, i2], 0, 0, playerRects[i, i2].right - playerRects[i, i2].left, playerRects[i, i2].bottom - playerRects[i, i2].top);
  470.  
  471.         running[-16, 0, 0] := -14;    {new hori velocity}
  472.         running[-16, 0, 1] := 1;        {bird leg mode}
  473.         running[-15, 0, 0] := -13;
  474.         running[-15, 0, 1] := 1;
  475.         running[-14, 0, 0] := -12;
  476.         running[-14, 0, 1] := 1;
  477.         running[-13, 0, 0] := -11;
  478.         running[-13, 0, 1] := 1;
  479.         running[-12, 0, 0] := -10;
  480.         running[-12, 0, 1] := 1;
  481.         running[-11, 0, 0] := -9;
  482.         running[-11, 0, 1] := 1;
  483.         running[-10, 0, 0] := -8;
  484.         running[-10, 0, 1] := 1;
  485.         running[-9, 0, 0] := -7;
  486.         running[-9, 0, 1] := 1;
  487.         running[-8, 0, 0] := -6;
  488.         running[-8, 0, 1] := 1;
  489.         running[-7, 0, 0] := -5;
  490.         running[-7, 0, 1] := 1;
  491.         running[-6, 0, 0] := -4;
  492.         running[-6, 0, 1] := 1;
  493.         running[-5, 0, 0] := -3;
  494.         running[-5, 0, 1] := 1;
  495.         running[-4, 0, 0] := -2;
  496.         running[-4, 0, 1] := 1;
  497.         running[-3, 0, 0] := -1;
  498.         running[-3, 0, 1] := 1;
  499.         running[-2, 0, 0] := 0;
  500.         running[-2, 0, 1] := 1;
  501.         running[-1, 0, 0] := 1;
  502.         running[-1, 0, 1] := 1;
  503.         running[0, 0, 0] := 4;
  504.         running[0, 0, 1] := 0;
  505.         running[1, 0, 0] := 4;
  506.         running[1, 0, 1] := 0;
  507.         running[2, 0, 0] := 4;
  508.         running[2, 0, 1] := 0;
  509.         running[3, 0, 0] := 12;
  510.         running[3, 0, 1] := 3;
  511.         running[4, 0, 0] := 11;
  512.         running[4, 0, 1] := 1;
  513.         running[5, 0, 0] := 4;
  514.         running[5, 0, 1] := 0;
  515.         running[6, 0, 0] := 4;
  516.         running[6, 0, 1] := 0;
  517.         running[7, 0, 0] := 4;
  518.         running[7, 0, 1] := 0;
  519.         running[8, 0, 0] := 12;
  520.         running[8, 0, 1] := 3;
  521.         running[9, 0, 0] := 12;
  522.         running[9, 0, 1] := 3;
  523.         running[10, 0, 0] := 12;
  524.         running[10, 0, 1] := 3;
  525.         running[11, 0, 0] := 3;
  526.         running[11, 0, 1] := 2;
  527.         running[12, 0, 0] := 4;
  528.         running[12, 0, 1] := 0;
  529.         running[13, 0, 0] := 11;
  530.         running[13, 0, 1] := 1;
  531.         running[14, 0, 0] := 12;
  532.         running[14, 0, 1] := 1;
  533.         running[15, 0, 0] := 13;
  534.         running[15, 0, 1] := 1;
  535.         running[16, 0, 0] := 14;
  536.         running[16, 0, 1] := 1;
  537.  
  538.         for i := -16 to 16 do
  539.             begin
  540.                 running[i, 1, 0] := -running[-i, 0, 0];
  541.                 running[i, 1, 1] := running[-i, 0, 1];
  542.             end;
  543.  
  544.         for i := 2 to 16 do
  545.             begin
  546.                 idleLanded[i] := i - 2;
  547.                 idleLanded[-i] := -i + 2;
  548.             end;
  549.         idleLanded[-1] := 0;
  550.         idleLanded[0] := 0;
  551.         idleLanded[1] := 0;
  552.  
  553.         for i := -16 to -1 do
  554.             begin
  555.                 gliding[i, 0] := i + 3;
  556.                 gliding[-i, 1] := -i - 3;
  557.             end;
  558.  
  559.         for i := 0 to 14 do
  560.             begin
  561.                 gliding[i, 0] := i + 2;
  562.                 gliding[-i, 1] := -i - 2;
  563.             end;
  564.  
  565.         gliding[16, 0] := 16;
  566.         gliding[-16, 1] := -16;
  567.         gliding[15, 0] := 16;
  568.         gliding[-15, 1] := -16;
  569.  
  570.         for i := -70 to 16 do
  571.             begin
  572.                 impacted[i] := (-2 * i) div 3;
  573.             end;
  574.         SetRect(tombRects[-5], -61, 424, 206, 440);    {acid cover left}
  575.         SetRect(tombRects[-4], 433, 424, 700, 440);    {acid cover right}
  576.         SetRect(tombRects[-3], 232, 180, 407, 197);    {top floor center}
  577.         SetRect(tombRects[-2], 206, 424, 433, 460);    {bottom floor center}
  578.         SetRect(tombRects[-1], -61, 424, 700, 440);    {whole floor bottom}
  579.         SetRect(tombRects[0], 206, 424, 433, 460);    {bottom floor center}
  580.         SetRect(tombRects[1], -117, 283, 150, 300);    {bottom floor left}
  581.         SetRect(tombRects[2], 490, 283, 757, 300);    {bottom floor right}
  582.         SetRect(tombRects[3], -107, 104, 160, 121);    {top floor left}
  583.         SetRect(tombRects[4], 480, 104, 747, 121);    {top floor right}
  584.         SetRect(tombRects[5], 232, 180, 407, 197);    {top floor center}
  585.         SetRect(tombRects[6], -61, 424, 206, 440);    {acid cover left}
  586.  
  587.         SetRect(eyeRects[0], 196, 219, 244, 250);
  588.         SetRect(eyeRects[1], 196, 187, 244, 218);
  589.         SetRect(eyeRects[2], 196, 155, 244, 186);
  590.         SetRect(eyeRects[3], 196, 123, 244, 154);
  591.         SetRect(eyeRects[4], 196, 123, 244, 154);
  592.  
  593.         with theEye do
  594.             begin
  595.                 dest := eyeRects[4];
  596.                 CenterZeroRect(dest);
  597.                 OffsetRect(dest, 320, upperEyeHeight);
  598.                 oldDest := dest;
  599.             end;
  600.  
  601.         SetRect(eggRects, 456, 0, 480, 24);
  602.         SetRect(flameRect[0], 80, 307, 112, 342);
  603.         SetRect(flameRect[1], 528, 307, 560, 342);
  604.         SetRect(shortStoneSrc, 337, 236, 512, 253);
  605.         SetRect(longStoneSrc, 245, 253, 512, 270);
  606.         SetRect(playRect, 15, 37, 625, 440);
  607.         SetRect(gameoverRects, 245, 145, 457, 179);
  608.  
  609.         doneFlag := FALSE;
  610.  
  611.         NewLightning;
  612.         ReadInScores;
  613.         CloseLogoWindo;
  614.         RedoTheBackground;
  615.         DoTheSound('music.snd', highPriority);
  616.         ReDrawHiScores;
  617.         FlushEvents(everyEvent, 0);
  618.         repeat
  619.         until (soundPriority = noSound);
  620.         InitCursor;
  621.         CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, mainWndo^.portBits, eyeRects[4], eyeRects[4], theEye.dest);
  622.         DoTheSound('lightning.snd', highPriority);
  623.         SetPort(GrafPtr(mainWndo));
  624.         for i := 1 to 3 do
  625.             StrikeLightning(upperEye);
  626.         CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, mainWndo^.portBits, theEye.dest, theEye.dest, srcCopy, playRgn);
  627.         FlushEvents(everyEvent, 0);
  628.     end;
  629.  
  630. {=================================}
  631.  
  632. end.